﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace assignment5
{
     internal class Order
    {
        private int orderID;
        private string customer;
        private int totalMoney;

        public List<OrderDetails> details = new List<OrderDetails>();

        public int OrderID { get { return orderID; } set { orderID = value; } }
        public string Customer { get { return customer; } set { customer = value; } }
        public int TotalMoney { get { return totalMoney; } set { totalMoney = value; } }

        public Order() { }
        public Order(int orderID, string customer, int totalMoney)
        {
            OrderID = orderID;
            Customer = customer;
            TotalMoney = totalMoney;
        }

        public void ToString(Order order)
        {
            Console.WriteLine(order.OrderID+", "+ order.Customer+", "+order.TotalMoney);
        }

        //添加订单明细
        public void AddOrderDetails(Order order, OrderDetails detail)
        {
            if (!order.details.Contains(detail))
            {
                order.details.Add(detail);

                Console.WriteLine("详细信息添加完成！");
            }
            else
            {
                Console.WriteLine("已添加过此订单明细！");
            }
        }

    }
}
